package com.fowo.api.sys.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fowo.api.common.annotaion.Sensitive;
import com.fowo.api.common.annotaion.TitleField;
import com.fowo.api.common.validator.Phone;
import com.fowo.api.sys.entity.SysBase;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import java.io.Serializable;
import java.util.Date;

/**
 * 系统用户
 */
@Schema(title = "系统用户")
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("sys_user")
public class SysUser extends SysBase implements Serializable {
    /**
     * 用户名
     */
    @Schema(title = "用户名")
    @TitleField(order = 2)
    private String username;
    /**
     * 显示用户名
     */
    @Schema(title = "显示用户名")
    @TitleField(order = 1)
    private String name;
    /**
     * 头像
     */
    @Schema(title = "头像")
    private String avatar;
    /**
     * 手机号
     */
    @Schema(title = "手机号")
    @Phone
    private String mobile;
    /**
     * 已验证的邮件地址
     */
    @Schema(title = "已验证的邮件地址")
    @Email
    private String verifiedMail;
    /**
     * 密码
     */
    @Schema(title = "密码")
    @Sensitive
    private String password;
    /**
     * 是否禁用
     */
    @Schema(title = "是否禁用")
    private Boolean isDisabled;

    /**
     * 最近一次登录失败时间
     */
    @Schema(hidden = true)
    private Date lastLoginFailTime;

    /**
     * 连续登录失败计数
     */
    @Schema(hidden = true)
    private Integer loginFailCount;

    /**
     * 连续登录失败后解锁时间
     */
    @Schema(hidden = true)
    private Date loginFailUnlockTime;
}
